package com.tudouji.project.copy.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.copy.domain.Copytokditem;
import com.tudouji.project.copy.service.ICopytokditemService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 待同步数据明细Controller
 * 
 * @author wf
 * @date 2021-01-11
 */
@RestController
@RequestMapping("/copy/copytokditem")
public class CopytokditemController extends BaseController
{
    @Autowired
    private ICopytokditemService copytokditemService;

    /**
     * 查询待同步数据明细列表
     */
    @PreAuthorize("@ss.hasPermi('copy:copytokditem:list')")
    @GetMapping("/list")
    public TableDataInfo list(Copytokditem copytokditem)
    {
        startPage();
        List<Copytokditem> list = copytokditemService.selectCopytokditemList(copytokditem);
        return getDataTable(list);
    }

    /**
     * 导出待同步数据明细列表
     */
    @PreAuthorize("@ss.hasPermi('copy:copytokditem:export')")
    @Log(title = "待同步数据明细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Copytokditem copytokditem)
    {
        List<Copytokditem> list = copytokditemService.selectCopytokditemList(copytokditem);
        ExcelUtil<Copytokditem> util = new ExcelUtil<Copytokditem>(Copytokditem.class);
        return util.exportExcel(list, "copytokditem");
    }

    /**
     * 获取待同步数据明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('copy:copytokditem:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(copytokditemService.selectCopytokditemById(id));
    }

    /**
     * 新增待同步数据明细
     */
    @PreAuthorize("@ss.hasPermi('copy:copytokditem:add')")
    @Log(title = "待同步数据明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Copytokditem copytokditem)
    {
        return toAjax(copytokditemService.insertCopytokditem(copytokditem));
    }

    /**
     * 修改待同步数据明细
     */
    @PreAuthorize("@ss.hasPermi('copy:copytokditem:edit')")
    @Log(title = "待同步数据明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Copytokditem copytokditem)
    {
        return toAjax(copytokditemService.updateCopytokditem(copytokditem));
    }

    /**
     * 删除待同步数据明细
     */
    @PreAuthorize("@ss.hasPermi('copy:copytokditem:remove')")
    @Log(title = "待同步数据明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(copytokditemService.deleteCopytokditemByIds(ids));
    }
}
